import java.util.Arrays;

public class SolutionLCP18 {
    public int breakfastNumber(int[] staple, int[] drinks, int x) {
        Arrays.sort(staple);
        Arrays.sort(drinks);
        int t=drinks.length-1;
        int ans=0;
        for (int j : staple) {
            while (t >= 0 && j + drinks[t] > x) {
                t--;
            }
            ans = (ans + t + 1) % 1000000007;
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new SolutionLCP18().breakfastNumber(new int[]{10,20,5},new int[]{5,5,2},15));
    }
}
